package it.das.service;

import it.das.task.ITask;

/**
 * This class contains the services executing certain business logic. 
 * Each service is a SET of tasks executed in specific order to accompalish the businesslogic.
 * 
 * @author ad
 *
 */

public class BusinessModuleServices {
	
	/**
	 * Service X is composed of set of Tasks A and B
	 * The task B is performed then task A
	 * @param input
	 */
	public void doServiceX(Object input) throws Exception{
		//ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] {"Spring-Beans.xml"});
		//ITask taskA = (ITask)appContext.getBean("taskA");
		ITask taskB = TaskBeanLookupService.getTaskByName("taskB");
		taskB.perform(input);
		ITask taskA = TaskBeanLookupService.getTaskByName("taskA");
		taskA.perform(input);
	}

	/**
	 * Service Y is composed of Task B and Task C 
	 * @param input
	 * @throws Exception
	 */
	public void doServiceY(Object input) throws Exception{
		ITask taskB = TaskBeanLookupService.getTaskByName("taskB");
		taskB.perform(input);
		ITask taskC = TaskBeanLookupService.getTaskByName("taskC");
		taskC.perform(input);
	}
}
